#!/bin/bash
# 开始下载
URL=https://archive.apache.org/dist/rocketmq/4.9.0/rocketmq-all-4.9.0-bin-release.zip
source ../linux/download_unzip.sh "rocketmq" $URL

# >>> source 调用本脚本时可用变量
# >>> $FILE_PATH 文件绝对路径：/opt/software/rocketmq-all-4.7.0-bin-release.zip
# >>> $FILE_EXTENSI 文件后缀：zip
# >>> $File_HOME 软件HOME：/opt/module/rocketmq/rocketmq-all-4.7.0-bin-release
# >>> $REPO_PATH 仓库目录：/opt/repository/rocketmq
exit
#改小内存，测试环境带不起来。
SERVER_JVM1='JAVA_OPT="${JAVA_OPT} -server -Xms4g -Xmx4g -Xmn2g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"'
SERVER_JVM2='JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx128m -Xmn128m -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=128m"'
BROKER_JVM1='JAVA_OPT="${JAVA_OPT} -server -Xms8g -Xmx8g -Xmn4g"'
BROKER_JVM2='JAVA_OPT="${JAVA_OPT} -server -Xms128m -Xmx128m -Xmn128m"'
if [ ! -f "$File_HOME/bin/runserver.sh.bak" ]; then
    cp $File_HOME/bin/runserver.sh $File_HOME/bin/runserver.sh.bak
fi
if [ ! -f "$File_HOME/bin/runbroker.sh.bak" ]; then
    cp $File_HOME/bin/runbroker.sh $File_HOME/bin/runbroker.sh.bak
fi
sed -i "s/$SERVER_JVM1/$SERVER_JVM2/g" $File_HOME/bin/runserver.sh
sed -i "s/$BROKER_JVM1/$BROKER_JVM2/g" $File_HOME/bin/runbroker.sh

#启动命令
IP=`/sbin/ifconfig -a|grep inet|grep -v 127.0.0.1|grep -v 172.17.0.1|grep -v 10.0.2.15|grep -v inet6|awk '{print $2}'|tr -d "addr:"`

echo "$File_HOME/bin/mqnamesrv"
echo "$File_HOME/bin/mqbroker -n $IP:9876"

#测试
export NAMESRV_ADDR=127.0.0.1:9876
echo "$File_HOME/bin/tools.sh org.apache.rocketmq.example.quickstart.Producer"
echo "$File_HOME/bin/tools.sh org.apache.rocketmq.example.quickstart.Consumer"







